#ifndef N1SHA_H_2009_09_28
#define N1SHA_H_2009_09_28

#include "N1Lib.h"

class N1SHA : public N1Object 
{
private:
    unsigned int naState[5];
    unsigned int naCount[2];
    union 
    {
        unsigned char caBuff[64];
        unsigned int  naBuff[16];
    };

public:
    N1SHA();
    virtual ~N1SHA();

    N1NAME_DECL;

    void resetSHA();
    void updateSHA(const void* pData, unsigned int nLen);
    void finalSHA();
    char* getPtrToHash();
    N1AnsiString* get();

    N1AnsiString* getHash(pcstr str);

private:
    void transformSHA();
    void reverseBytes(unsigned int *pBuff, int nLen);
};

#endif //N1SHA_H_2009_09_28
